package com.intct.redis;

import redis.clients.jedis.Jedis;
import redis.clients.jedis.params.SetParams;

/**
 * @author gufg
 * @since 2025-07-18 11:16
 */
public class JedisConnection {
    public static void main(String[] args) {
        // 连接到Redis
        Jedis jedis = new Jedis("cdh-node", 6379);

        // 输出密码
        jedis.auth("123456");

        // 执行Redis命令 set key value ex 120
        SetParams setParams = new SetParams();
        setParams.ex(120);

        jedis.set("string_api_key", "zhangsan", setParams);

        // 关闭Redis连接
        jedis.close();
    }
}
